diff options
Diffstat (limited to 'v3po')
20 files changed, 74 insertions, 73 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/InterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/InterfaceCustomizer.java index eb6426241..4e81ca0f2 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/InterfaceCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/InterfaceCustomizer.java @@ -20,7 +20,7 @@ import io.fd.honeycomb.v3po.translate.spi.write.ListWriterCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.VppApiInvocationException; -import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import io.fd.honeycomb.v3po.translate.write.WriteContext; import io.fd.honeycomb.v3po.translate.write.WriteFailedException; import java.util.List; @@ -123,7 +123,7 @@ public class InterfaceCustomizer extends FutureJVppCustomizer implements ListWri LOG.debug("Updating interface flags for: {}, index: {}, enabled: {}", swIfName, swIfIndex, enabled); - SwInterfaceSetFlagsReply reply = V3poUtils.getReply(swInterfaceSetFlagsReplyFuture.toCompletableFuture()); + SwInterfaceSetFlagsReply reply = TranslateUtils.getReply(swInterfaceSetFlagsReplyFuture.toCompletableFuture()); if (reply.retval < 0) { LOG.warn("Failed to update interface flags for: {}, index: {}, enabled: {}", swIfName, swIfIndex, enabled); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/L2Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/L2Customizer.java index 5aea5de2b..e3eff2d0f 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/L2Customizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/L2Customizer.java @@ -23,7 +23,7 @@ import io.fd.honeycomb.v3po.translate.spi.write.ChildWriterCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.VppApiInvocationException; -import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import io.fd.honeycomb.v3po.translate.write.WriteContext; import io.fd.honeycomb.v3po.translate.write.WriteFailedException; import java.util.concurrent.CompletionStage; @@ -147,7 +147,7 @@ public class L2Customizer extends FutureJVppCustomizer implements ChildWriterCus final CompletionStage<SwInterfaceSetL2BridgeReply> swInterfaceSetL2BridgeReplyCompletionStage = getFutureJVpp() .swInterfaceSetL2Bridge(getL2BridgeRequest(swIfIndex, bdId, shg, bvi, (byte) 1 /* enable */)); final SwInterfaceSetL2BridgeReply reply = - V3poUtils.getReply(swInterfaceSetL2BridgeReplyCompletionStage.toCompletableFuture()); + TranslateUtils.getReply(swInterfaceSetL2BridgeReplyCompletionStage.toCompletableFuture()); if (reply.retval < 0) { LOG.warn("Failed to update bridge based interconnection flags for: {}, interconnection: {}", ifcName, @@ -187,7 +187,7 @@ public class L2Customizer extends FutureJVppCustomizer implements ChildWriterCus getFutureJVpp() .swInterfaceSetL2Xconnect(getL2XConnectRequest(swIfIndex, outSwIfIndex, (byte) 1 /* enable */)); final SwInterfaceSetL2XconnectReply reply = - V3poUtils.getReply(swInterfaceSetL2XconnectReplyCompletionStage.toCompletableFuture()); + TranslateUtils.getReply(swInterfaceSetL2XconnectReplyCompletionStage.toCompletableFuture()); if (reply.retval < 0) { LOG.warn("Failed to update xconnect based interconnection flags for: {}, interconnection: {}", diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/RoutingCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/RoutingCustomizer.java index bf355e479..74aee7ae5 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/RoutingCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/RoutingCustomizer.java @@ -21,7 +21,7 @@ import io.fd.honeycomb.v3po.translate.spi.write.ChildWriterCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; import io.fd.honeycomb.v3po.translate.v3po.util.VppApiInvocationException; -import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import io.fd.honeycomb.v3po.translate.write.WriteContext; import io.fd.honeycomb.v3po.translate.write.WriteFailedException; import java.util.concurrent.CompletionStage; @@ -100,7 +100,7 @@ public class RoutingCustomizer extends FutureJVppCustomizer implements ChildWrit final CompletionStage<SwInterfaceSetTableReply> swInterfaceSetTableReplyCompletionStage = getFutureJVpp().swInterfaceSetTable(getInterfaceSetTableRequest(swIfc, (byte) 0, /* isIpv6 */ vrfId)); final SwInterfaceSetTableReply reply = - V3poUtils.getReply(swInterfaceSetTableReplyCompletionStage.toCompletableFuture()); + TranslateUtils.getReply(swInterfaceSetTableReplyCompletionStage.toCompletableFuture()); if (reply.retval < 0) { LOG.debug("Failed to set routing for interface: {}, {}, vxlan: {}", name, swIfc, rt); throw new VppApiInvocationException("swInterfaceSetTable", reply.context, reply.retval); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/SubInterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/SubInterfaceCustomizer.java index fb47b6a9f..17342e347 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/SubInterfaceCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/SubInterfaceCustomizer.java @@ -16,14 +16,14 @@ package io.fd.honeycomb.v3po.translate.v3po.interfaces; -import static io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils.booleanToByte; +import static io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils.booleanToByte; import com.google.common.base.Optional; import com.google.common.base.Preconditions; import io.fd.honeycomb.v3po.translate.v3po.util.AbstractInterfaceTypeCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; import io.fd.honeycomb.v3po.translate.v3po.util.VppApiInvocationException; -import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import io.fd.honeycomb.v3po.translate.write.WriteContext; import io.fd.honeycomb.v3po.translate.write.WriteFailedException; import java.util.concurrent.CompletionStage; @@ -90,7 +90,7 @@ public class SubInterfaceCustomizer extends AbstractInterfaceTypeCustomizer<SubI getFutureJVpp().createSubif(getCreateSubifRequest(subInterface, swIfIndex)); final CreateSubifReply reply = - V3poUtils.getReply(createSubifReplyCompletionStage.toCompletableFuture()); + TranslateUtils.getReply(createSubifReplyCompletionStage.toCompletableFuture()); if (reply.retval < 0) { LOG.debug("Failed to create sub interface for: {}, subInterface: {}", swIfName, subInterface); throw new VppApiInvocationException("createSubif", reply.context, reply.retval); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/TapCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/TapCustomizer.java index bafe788ad..5f98ade94 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/TapCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/TapCustomizer.java @@ -20,7 +20,7 @@ import com.google.common.base.Optional; import io.fd.honeycomb.v3po.translate.v3po.util.AbstractInterfaceTypeCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; import io.fd.honeycomb.v3po.translate.v3po.util.VppApiInvocationException; -import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import io.fd.honeycomb.v3po.translate.write.WriteContext; import io.fd.honeycomb.v3po.translate.write.WriteFailedException; import java.util.concurrent.CompletionStage; @@ -123,7 +123,7 @@ public class TapCustomizer extends AbstractInterfaceTypeCustomizer<Tap> { final CompletionStage<TapConnectReply> tapConnectFuture = getFutureJVpp().tapConnect(getTapConnectRequest(tap.getTapName(), tap.getMac(), tap.getDeviceInstance())); final TapConnectReply reply = - V3poUtils.getReply(tapConnectFuture.toCompletableFuture()); + TranslateUtils.getReply(tapConnectFuture.toCompletableFuture()); if (reply.retval < 0) { LOG.warn("Failed to set tap interface: {}, tap: {}", swIfName, tap); throw new VppApiInvocationException("tap_connect", reply.context, reply.retval); @@ -139,7 +139,7 @@ public class TapCustomizer extends AbstractInterfaceTypeCustomizer<Tap> { final CompletionStage<TapModifyReply> vxlanAddDelTunnelReplyCompletionStage = getFutureJVpp().tapModify(getTapModifyRequest(tap.getTapName(), index, tap.getMac(), tap.getDeviceInstance())); final TapModifyReply reply = - V3poUtils.getReply(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture()); + TranslateUtils.getReply(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture()); if (reply.retval < 0) { LOG.warn("Failed to modify tap interface: {}, tap: {}", swIfName, tap); throw new VppApiInvocationException("tap_modify", reply.context, reply.retval); @@ -155,7 +155,7 @@ public class TapCustomizer extends AbstractInterfaceTypeCustomizer<Tap> { final CompletionStage<TapDeleteReply> vxlanAddDelTunnelReplyCompletionStage = getFutureJVpp().tapDelete(getTapDeleteRequest(index)); final TapDeleteReply reply = - V3poUtils.getReply(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture()); + TranslateUtils.getReply(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture()); if (reply.retval < 0) { LOG.warn("Failed to delete tap interface: {}, tap: {}", swIfName, dataBefore); throw new VppApiInvocationException("tap_modify", reply.context, reply.retval); @@ -175,7 +175,7 @@ public class TapCustomizer extends AbstractInterfaceTypeCustomizer<Tap> { tapConnect.macAddress = new byte[6]; } else { tapConnect.useRandomMac = 0; - tapConnect.macAddress = V3poUtils.parseMac(mac.getValue()); + tapConnect.macAddress = TranslateUtils.parseMac(mac.getValue()); } if(deviceInstance == null) { @@ -198,7 +198,7 @@ public class TapCustomizer extends AbstractInterfaceTypeCustomizer<Tap> { tapConnect.macAddress = new byte[6]; } else { tapConnect.useRandomMac = 0; - tapConnect.macAddress = V3poUtils.parseMac(mac.getValue()); + tapConnect.macAddress = TranslateUtils.parseMac(mac.getValue()); } if(deviceInstance == null) { diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VhostUserCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VhostUserCustomizer.java index aef45c821..6c45e98ac 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VhostUserCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VhostUserCustomizer.java @@ -21,7 +21,7 @@ import com.google.common.base.Preconditions; import io.fd.honeycomb.v3po.translate.v3po.util.AbstractInterfaceTypeCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; import io.fd.honeycomb.v3po.translate.v3po.util.VppApiInvocationException; -import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import io.fd.honeycomb.v3po.translate.write.WriteContext; import io.fd.honeycomb.v3po.translate.write.WriteFailedException; import java.util.concurrent.CompletionStage; @@ -85,7 +85,7 @@ public class VhostUserCustomizer extends AbstractInterfaceTypeCustomizer<VhostUs getFutureJVpp().createVhostUserIf(getCreateVhostUserIfRequest(vhostUser)); final CreateVhostUserIfReply reply = - V3poUtils.getReply(createVhostUserIfReplyCompletionStage.toCompletableFuture()); + TranslateUtils.getReply(createVhostUserIfReplyCompletionStage.toCompletableFuture()); if (reply.retval < 0) { LOG.debug("Failed to create vhost user interface: {}, vhostUser: {}", swIfName, vhostUser); throw new VppApiInvocationException("createVhostUserIf", reply.context, reply.retval); @@ -98,7 +98,7 @@ public class VhostUserCustomizer extends AbstractInterfaceTypeCustomizer<VhostUs private CreateVhostUserIf getCreateVhostUserIfRequest(final VhostUser vhostUser) { CreateVhostUserIf request = new CreateVhostUserIf(); - request.isServer = V3poUtils.booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole())); + request.isServer = TranslateUtils.booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole())); request.sockFilename = vhostUser.getSocket().getBytes(); request.renumber = 0; // TODO request.customDevInstance = 0; // TODO @@ -126,7 +126,7 @@ public class VhostUserCustomizer extends AbstractInterfaceTypeCustomizer<VhostUs .modifyVhostUserIf(getModifyVhostUserIfRequest(vhostUser, interfaceContext.getIndex(swIfName, writeContext.getMappingContext()))); final ModifyVhostUserIfReply reply = - V3poUtils.getReply(modifyVhostUserIfReplyCompletionStage.toCompletableFuture()); + TranslateUtils.getReply(modifyVhostUserIfReplyCompletionStage.toCompletableFuture()); if (reply.retval < 0) { LOG.debug("Failed to update vhost user interface: {}, vhostUser: {}", swIfName, vhostUser); throw new VppApiInvocationException("modifyVhostUserIf", reply.context, reply.retval); @@ -137,7 +137,7 @@ public class VhostUserCustomizer extends AbstractInterfaceTypeCustomizer<VhostUs private ModifyVhostUserIf getModifyVhostUserIfRequest(final VhostUser vhostUser, final int swIfIndex) { ModifyVhostUserIf request = new ModifyVhostUserIf(); - request.isServer = V3poUtils.booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole())); + request.isServer = TranslateUtils.booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole())); request.sockFilename = vhostUser.getSocket().getBytes(); request.renumber = 0; // TODO request.customDevInstance = 0; // TODO @@ -162,7 +162,7 @@ public class VhostUserCustomizer extends AbstractInterfaceTypeCustomizer<VhostUs getFutureJVpp().deleteVhostUserIf(getDeleteVhostUserIfRequest(interfaceContext.getIndex(swIfName, writeContext.getMappingContext()))); final DeleteVhostUserIfReply reply = - V3poUtils.getReply(deleteVhostUserIfReplyCompletionStage.toCompletableFuture()); + TranslateUtils.getReply(deleteVhostUserIfReplyCompletionStage.toCompletableFuture()); if (reply.retval < 0) { LOG.debug("Failed to delete vhost user interface: {}, vhostUser: {}", swIfName, vhostUser); throw new VppApiInvocationException("modifyVhostUserIf", reply.context, reply.retval); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VlanTagRewriteCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VlanTagRewriteCustomizer.java index 497a83e48..721d15530 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VlanTagRewriteCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VlanTagRewriteCustomizer.java @@ -21,7 +21,7 @@ import com.google.common.base.Preconditions; import io.fd.honeycomb.v3po.translate.v3po.util.AbstractInterfaceTypeCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; import io.fd.honeycomb.v3po.translate.v3po.util.VppApiInvocationException; -import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import io.fd.honeycomb.v3po.translate.write.WriteContext; import io.fd.honeycomb.v3po.translate.write.WriteFailedException; import java.util.concurrent.CompletionStage; @@ -89,7 +89,7 @@ public class VlanTagRewriteCustomizer extends AbstractInterfaceTypeCustomizer<Vl final CompletionStage<L2InterfaceVlanTagRewriteReply> replyCompletionStage = getFutureJVpp().l2InterfaceVlanTagRewrite(getTagRewriteRequest(swIfIndex, cfg)); - final L2InterfaceVlanTagRewriteReply reply = V3poUtils.getReply(replyCompletionStage.toCompletableFuture()); + final L2InterfaceVlanTagRewriteReply reply = TranslateUtils.getReply(replyCompletionStage.toCompletableFuture()); if (reply.retval < 0) { LOG.debug("Failed to set tag rewrite for interface {}(id=): {}", ifname, swIfIndex, cfg); throw new VppApiInvocationException("l2InterfaceVlanTagRewrite", reply.context, reply.retval); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VxlanCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VxlanCustomizer.java index bec0e8366..5b2be71cc 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VxlanCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VxlanCustomizer.java @@ -23,7 +23,7 @@ import com.google.common.net.InetAddresses; import io.fd.honeycomb.v3po.translate.v3po.util.AbstractInterfaceTypeCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; import io.fd.honeycomb.v3po.translate.v3po.util.VppApiInvocationException; -import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import io.fd.honeycomb.v3po.translate.write.WriteContext; import io.fd.honeycomb.v3po.translate.write.WriteFailedException; import java.net.InetAddress; @@ -112,7 +112,7 @@ public class VxlanCustomizer extends AbstractInterfaceTypeCustomizer<Vxlan> { dstAddress.getAddress(), encapVrfId, -1, vni, isIpv6)); final VxlanAddDelTunnelReply reply = - V3poUtils.getReply(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture()); + TranslateUtils.getReply(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture()); if (reply.retval < 0) { LOG.debug("Failed to set vxlan tunnel for interface: {}, vxlan: {}", swIfName, vxlan); throw new VppApiInvocationException("vxlanAddDelTunnel", reply.context, reply.retval); @@ -166,7 +166,7 @@ public class VxlanCustomizer extends AbstractInterfaceTypeCustomizer<Vxlan> { dstAddress.getAddress(), encapVrfId, -1, vni, isIpv6)); final VxlanAddDelTunnelReply reply = - V3poUtils.getReply(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture()); + TranslateUtils.getReply(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture()); if (reply.retval < 0) { LOG.debug("Failed to delete vxlan tunnel for interface: {}, vxlan: {}", swIfName, vxlan); throw new VppApiInvocationException("vxlanAddDelTunnel", reply.context, reply.retval); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/ip/Ipv4Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/ip/Ipv4Customizer.java index 4deb38f52..fb891f838 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/ip/Ipv4Customizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/ip/Ipv4Customizer.java @@ -24,7 +24,7 @@ import io.fd.honeycomb.v3po.translate.spi.write.ChildWriterCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.VppApiInvocationException; -import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import io.fd.honeycomb.v3po.translate.write.WriteContext; import io.fd.honeycomb.v3po.translate.write.WriteFailedException; import java.util.concurrent.CompletionStage; @@ -131,7 +131,7 @@ public class Ipv4Customizer extends FutureJVppCustomizer implements ChildWriterC LOG.debug("Setting Subnet(prefix-length) for interface: {}, {}. Subnet: {}, Ipv4: {}", name, swIfc, subnet, ipv4Addr); - byte[] addr = V3poUtils.ipv4AddressNoZoneToArray(ipv4Addr.getIp()); + byte[] addr = TranslateUtils.ipv4AddressNoZoneToArray(ipv4Addr.getIp()); checkArgument(plen > 0, "Invalid length"); checkNotNull(addr, "Null address"); @@ -141,7 +141,7 @@ public class Ipv4Customizer extends FutureJVppCustomizer implements ChildWriterC swIfc, (byte) 1 /* isAdd */, (byte) 0 /* isIpv6 */, (byte) 0 /* delAll */, plen.byteValue(), addr)); final SwInterfaceAddDelAddressReply reply = - V3poUtils.getReply(swInterfaceAddDelAddressReplyCompletionStage.toCompletableFuture()); + TranslateUtils.getReply(swInterfaceAddDelAddressReplyCompletionStage.toCompletableFuture()); if (reply.retval < 0) { LOG.warn("Failed to set Subnet(prefix-length) for interface: {}, {}, Subnet: {}, Ipv4: {}", name, swIfc, diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceCustomizer.java index 87c62f48f..4027941eb 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceCustomizer.java @@ -22,7 +22,7 @@ import io.fd.honeycomb.v3po.translate.read.ReadFailedException; import io.fd.honeycomb.v3po.translate.spi.read.ListReaderCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; -import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -113,7 +113,7 @@ public class InterfaceCustomizer extends FutureJVppCustomizer final CompletableFuture<SwInterfaceDetailsReplyDump> swInterfaceDetailsReplyDumpCompletableFuture = getFutureJVpp().swInterfaceDump(request).toCompletableFuture(); - final SwInterfaceDetailsReplyDump ifaces = V3poUtils.getReply(swInterfaceDetailsReplyDumpCompletableFuture); + final SwInterfaceDetailsReplyDump ifaces = TranslateUtils.getReply(swInterfaceDetailsReplyDumpCompletableFuture); if (null == ifaces || null == ifaces.swInterfaceDetails) { LOG.debug("No interfaces found in VPP"); @@ -129,7 +129,7 @@ public class InterfaceCustomizer extends FutureJVppCustomizer .map((elt) -> { // Store interface name from VPP in context if not yet present if (!interfaceContext.containsName(elt.swIfIndex, context.getMappingContext())) { - interfaceContext.addName(elt.swIfIndex, V3poUtils.toString(elt.interfaceName), context.getMappingContext()); + interfaceContext.addName(elt.swIfIndex, TranslateUtils.toString(elt.interfaceName), context.getMappingContext()); } LOG.trace("Interface with name: {}, VPP name: {} and index: {} found in VPP", interfaceContext.getName(elt.swIfIndex, context.getMappingContext()), elt.interfaceName, elt.swIfIndex); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceUtils.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceUtils.java index bbcb4fdb9..be9b34730 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceUtils.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceUtils.java @@ -22,7 +22,7 @@ import static io.fd.honeycomb.v3po.translate.v3po.interfacesstate.InterfaceCusto import com.google.common.base.Preconditions; import com.google.common.collect.Iterables; import io.fd.honeycomb.v3po.translate.ModificationCache; -import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import java.math.BigInteger; import java.util.Map; import java.util.Objects; @@ -171,7 +171,7 @@ public final class InterfaceUtils { } CompletionStage<SwInterfaceDetailsReplyDump> requestFuture = futureJvpp.swInterfaceDump(request); - SwInterfaceDetailsReplyDump ifaces = V3poUtils.getReply(requestFuture.toCompletableFuture()); + SwInterfaceDetailsReplyDump ifaces = TranslateUtils.getReply(requestFuture.toCompletableFuture()); if (null == ifaces || null == ifaces.swInterfaceDetails || ifaces.swInterfaceDetails.isEmpty()) { request.nameFilterValid = 0; @@ -180,7 +180,7 @@ public final class InterfaceUtils { // Or else just perform full dump and do inefficient filtering requestFuture = futureJvpp.swInterfaceDump(request); - ifaces = V3poUtils.getReply(requestFuture.toCompletableFuture()); + ifaces = TranslateUtils.getReply(requestFuture.toCompletableFuture()); // Update the cache allInterfaces.clear(); @@ -235,6 +235,6 @@ public final class InterfaceUtils { static boolean isInterfaceOfType(final Class<? extends InterfaceType> ifcType, final SwInterfaceDetails cachedDetails) { - return ifcType.equals(getInterfaceType(V3poUtils.toString(cachedDetails.interfaceName))); + return ifcType.equals(getInterfaceType(TranslateUtils.toString(cachedDetails.interfaceName))); } } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/L2Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/L2Customizer.java index f0d260de2..1fedd4a55 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/L2Customizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/L2Customizer.java @@ -24,7 +24,7 @@ import io.fd.honeycomb.v3po.translate.read.ReadFailedException; import io.fd.honeycomb.v3po.translate.spi.read.ChildReaderCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; -import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import java.util.Optional; import java.util.concurrent.CompletableFuture; import javax.annotation.Nonnull; @@ -136,6 +136,6 @@ public class L2Customizer extends FutureJVppCustomizer final CompletableFuture<BridgeDomainDetailsReplyDump> bdCompletableFuture = getFutureJVpp().bridgeDomainSwIfDump(request).toCompletableFuture(); - return V3poUtils.getReply(bdCompletableFuture); + return TranslateUtils.getReply(bdCompletableFuture); } } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/TapCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/TapCustomizer.java index 358e9149a..d4fe30b57 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/TapCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/TapCustomizer.java @@ -23,7 +23,7 @@ import io.fd.honeycomb.v3po.translate.read.ReadFailedException; import io.fd.honeycomb.v3po.translate.spi.read.ChildReaderCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; -import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import java.util.Collections; import java.util.List; import java.util.Map; @@ -93,7 +93,7 @@ public class TapCustomizer extends FutureJVppCustomizer final CompletionStage<SwInterfaceTapDetailsReplyDump> swInterfaceTapDetailsReplyDumpCompletionStage = getFutureJVpp().swInterfaceTapDump(request); final SwInterfaceTapDetailsReplyDump reply = - V3poUtils.getReply(swInterfaceTapDetailsReplyDumpCompletionStage.toCompletableFuture()); + TranslateUtils.getReply(swInterfaceTapDetailsReplyDumpCompletionStage.toCompletableFuture()); if(null == reply || null == reply.swInterfaceTapDetails) { mappedTaps = Collections.emptyMap(); @@ -110,7 +110,7 @@ public class TapCustomizer extends FutureJVppCustomizer final SwInterfaceTapDetails swInterfaceTapDetails = mappedTaps.get(index); LOG.trace("Tap interface: {} attributes returned from VPP: {}", key.getName(), swInterfaceTapDetails); - builder.setTapName(V3poUtils.toString(swInterfaceTapDetails.devName)); + builder.setTapName(TranslateUtils.toString(swInterfaceTapDetails.devName)); LOG.debug("Tap interface: {}, id: {} attributes read as: {}", key.getName(), index, builder); } } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java index d5ae8faf3..de7514524 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java @@ -23,7 +23,7 @@ import io.fd.honeycomb.v3po.translate.read.ReadFailedException; import io.fd.honeycomb.v3po.translate.spi.read.ChildReaderCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; -import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import java.math.BigInteger; import java.util.Collections; import java.util.List; @@ -95,7 +95,7 @@ public class VhostUserCustomizer extends FutureJVppCustomizer final CompletionStage<SwInterfaceVhostUserDetailsReplyDump> swInterfaceVhostUserDetailsReplyDumpCompletionStage = getFutureJVpp().swInterfaceVhostUserDump(request); final SwInterfaceVhostUserDetailsReplyDump reply = - V3poUtils.getReply(swInterfaceVhostUserDetailsReplyDumpCompletionStage.toCompletableFuture()); + TranslateUtils.getReply(swInterfaceVhostUserDetailsReplyDumpCompletionStage.toCompletableFuture()); if(null == reply || null == reply.swInterfaceVhostUserDetails) { mappedVhostUsers = Collections.emptyMap(); @@ -116,7 +116,7 @@ public class VhostUserCustomizer extends FutureJVppCustomizer builder.setRole(swInterfaceVhostUserDetails.isServer == 1 ? VhostUserRole.Server : VhostUserRole.Client); builder.setFeatures(BigInteger.valueOf(swInterfaceVhostUserDetails.features)); builder.setNumMemoryRegions((long) swInterfaceVhostUserDetails.numRegions); - builder.setSocket(V3poUtils.toString(swInterfaceVhostUserDetails.sockFilename)); + builder.setSocket(TranslateUtils.toString(swInterfaceVhostUserDetails.sockFilename)); builder.setVirtioNetHdrSize((long) swInterfaceVhostUserDetails.virtioNetHdrSz); builder.setConnectError(Integer.toString(swInterfaceVhostUserDetails.sockErrno)); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VxlanCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VxlanCustomizer.java index 81ba34062..9f385861a 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VxlanCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VxlanCustomizer.java @@ -23,7 +23,7 @@ import io.fd.honeycomb.v3po.translate.read.ReadFailedException; import io.fd.honeycomb.v3po.translate.spi.read.ChildReaderCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; -import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.Arrays; @@ -91,7 +91,7 @@ public class VxlanCustomizer extends FutureJVppCustomizer final CompletionStage<VxlanTunnelDetailsReplyDump> swInterfaceVxlanDetailsReplyDumpCompletionStage = getFutureJVpp().vxlanTunnelDump(request); final VxlanTunnelDetailsReplyDump reply = - V3poUtils.getReply(swInterfaceVxlanDetailsReplyDumpCompletionStage.toCompletableFuture()); + TranslateUtils.getReply(swInterfaceVxlanDetailsReplyDumpCompletionStage.toCompletableFuture()); // VPP keeps vxlan tunnel interfaces even after they were deleted (optimization) // However there ar no longer any vxlan tunnel specific fields assigned to it and this call diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizer.java index db1e61578..0b3545ddd 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizer.java @@ -24,7 +24,7 @@ import io.fd.honeycomb.v3po.translate.spi.write.ListWriterCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; import io.fd.honeycomb.v3po.translate.v3po.util.VppApiInvocationException; -import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import io.fd.honeycomb.v3po.translate.write.WriteContext; import io.fd.honeycomb.v3po.translate.write.WriteFailedException; import java.util.List; @@ -74,7 +74,7 @@ public class BridgeDomainCustomizer request.isAdd = ADD_OR_UPDATE_BD; final BridgeDomainAddDelReply reply = - V3poUtils.getReply(getFutureJVpp().bridgeDomainAddDel(request).toCompletableFuture()); + TranslateUtils.getReply(getFutureJVpp().bridgeDomainAddDel(request).toCompletableFuture()); if (reply.retval < 0) { LOG.warn("Bridge domain {} (id={}) add/update failed", bd.getName(), bdId); throw new VppApiInvocationException("bridgeDomainAddDel", reply.context, reply.retval); @@ -125,7 +125,7 @@ public class BridgeDomainCustomizer request.bdId = bdId; final BridgeDomainAddDelReply reply = - V3poUtils.getReply(getFutureJVpp().bridgeDomainAddDel(request).toCompletableFuture()); + TranslateUtils.getReply(getFutureJVpp().bridgeDomainAddDel(request).toCompletableFuture()); if (reply.retval < 0) { LOG.warn("Bridge domain {} (id={}) delete failed", bdName, bdId); throw new WriteFailedException.DeleteFailedException(id, diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VersionCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VersionCustomizer.java index 4ad4a6e91..ad181a701 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VersionCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VersionCustomizer.java @@ -20,7 +20,7 @@ import io.fd.honeycomb.v3po.translate.read.ReadContext; import io.fd.honeycomb.v3po.translate.read.ReadFailedException; import io.fd.honeycomb.v3po.translate.spi.read.ChildReaderCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; -import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppStateBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.Version; @@ -61,10 +61,10 @@ public final class VersionCustomizer } catch (Exception e) { throw new ReadFailedException(id, e); } - builder.setBranch(V3poUtils.toString(reply.version)); - builder.setName(V3poUtils.toString(reply.program)); - builder.setBuildDate(V3poUtils.toString(reply.buildDate)); - builder.setBuildDirectory(V3poUtils.toString(reply.buildDirectory)); + builder.setBranch(TranslateUtils.toString(reply.version)); + builder.setName(TranslateUtils.toString(reply.program)); + builder.setBuildDate(TranslateUtils.toString(reply.buildDate)); + builder.setBuildDirectory(TranslateUtils.toString(reply.buildDirectory)); } } diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VhostUserCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VhostUserCustomizerTest.java index a14718124..a6fb64331 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VhostUserCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VhostUserCustomizerTest.java @@ -36,7 +36,7 @@ import io.fd.honeycomb.v3po.translate.MappingContext; import io.fd.honeycomb.v3po.translate.ModificationCache; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; import io.fd.honeycomb.v3po.translate.v3po.util.VppApiInvocationException; -import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import io.fd.honeycomb.v3po.translate.write.WriteContext; import io.fd.honeycomb.v3po.translate.write.WriteFailedException; import java.util.concurrent.CompletableFuture; @@ -152,7 +152,7 @@ public class VhostUserCustomizerTest { final CreateVhostUserIf actual = argumentCaptor.getValue(); assertEquals(0, actual.customDevInstance); - assertEquals(V3poUtils.booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole())), actual.isServer); + assertEquals(TranslateUtils.booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole())), actual.isServer); assertEquals(0, actual.renumber); assertEquals(0, actual.useCustomMac); assertArrayEquals(vhostUser.getSocket().getBytes(), actual.sockFilename); @@ -166,7 +166,7 @@ public class VhostUserCustomizerTest { final ModifyVhostUserIf actual = argumentCaptor.getValue(); assertEquals(0, actual.customDevInstance); - assertEquals(V3poUtils.booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole())), actual.isServer); + assertEquals(TranslateUtils.booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole())), actual.isServer); assertEquals(0, actual.renumber); assertEquals(swIfIndex, actual.swIfIndex); assertArrayEquals(vhostUser.getSocket().getBytes(), actual.sockFilename); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/utils/V3poUtils.java b/v3po/vpp-translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtils.java index 8742d1d60..9f6f1f676 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/utils/V3poUtils.java +++ b/v3po/vpp-translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.honeycomb.v3po.translate.v3po.utils; +package io.fd.honeycomb.v3po.translate.v3po.util; import static com.google.common.base.Preconditions.checkArgument; @@ -28,13 +28,13 @@ import javax.annotation.Nullable; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone; import org.openvpp.jvpp.dto.JVppReply; -public final class V3poUtils { +public final class TranslateUtils { // TODO move to vpp-translate-utils public static final Splitter COLON_SPLITTER = Splitter.on(':'); - private V3poUtils() {} + private TranslateUtils() {} public static <REP extends JVppReply<?>> REP getReply(Future<REP> future) { try { @@ -78,7 +78,7 @@ public final class V3poUtils { } private static byte[] parseMacLikeString(final List<String> strings) { - return strings.stream().limit(6).map(V3poUtils::parseHexByte).collect( + return strings.stream().limit(6).map(TranslateUtils::parseHexByte).collect( () -> new byte[strings.size()], new BiConsumer<byte[], Byte>() { diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/utils/V3poUtilsTest.java b/v3po/vpp-translate-utils/src/test/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtilsTest.java index fcdca49b0..a3c37bade 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/utils/V3poUtilsTest.java +++ b/v3po/vpp-translate-utils/src/test/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtilsTest.java @@ -1,24 +1,25 @@ -package io.fd.honeycomb.v3po.translate.v3po.utils; +package io.fd.honeycomb.v3po.translate.v3po.util; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import org.junit.Test; -public class V3poUtilsTest { +public class TranslateUtilsTest { @Test public void testToString() { final byte[] expected = "test".getBytes(); final byte[] cString = new byte[expected.length+10]; System.arraycopy(expected, 0, cString, 0, expected.length); - final String jString = V3poUtils.toString(cString); + final String jString = TranslateUtils.toString(cString); assertArrayEquals(expected, jString.getBytes()); } @Test public void testParseMac() throws Exception { - byte[] bytes = V3poUtils.parseMac("00:fF:7f:15:5e:A9"); + byte[] bytes = TranslateUtils.parseMac("00:fF:7f:15:5e:A9"); assertMac(bytes); } @@ -34,28 +35,28 @@ public class V3poUtilsTest { @Test(expected = IllegalArgumentException.class) public void testParseMacLonger() throws Exception { - byte[] bytes = V3poUtils.parseMac("00:fF:7f:15:5e:A9:88:77"); + byte[] bytes = TranslateUtils.parseMac("00:fF:7f:15:5e:A9:88:77"); assertMac(bytes); } @Test(expected = IllegalArgumentException.class) public void testParseMacShorter() throws Exception { - V3poUtils.parseMac("00:fF:7f"); + TranslateUtils.parseMac("00:fF:7f"); } @Test(expected = IllegalArgumentException.class) public void testParseRandomString() throws Exception { - V3poUtils.parseMac("random{}}@$*&*!"); + TranslateUtils.parseMac("random{}}@$*&*!"); } @Test(expected = NumberFormatException.class) public void testParseMacNumberFormatEx() throws Exception { - V3poUtils.parseMac("00:XX:7f:15:5e:77\""); + TranslateUtils.parseMac("00:XX:7f:15:5e:77\""); } public void testBooleanToByte() { - assertEquals(0, V3poUtils.booleanToByte(null)); - assertEquals(0, V3poUtils.booleanToByte(false)); - assertEquals(1, V3poUtils.booleanToByte(true)); + assertEquals(0, TranslateUtils.booleanToByte(null)); + assertEquals(0, TranslateUtils.booleanToByte(false)); + assertEquals(1, TranslateUtils.booleanToByte(true)); } }
\ No newline at end of file |