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;
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);
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;
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,
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: {}",
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;
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);
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;
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);
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;
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);
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);
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);
tapConnect.macAddress = new byte[6];
} else {
tapConnect.useRandomMac = 0;
- tapConnect.macAddress = V3poUtils.parseMac(mac.getValue());
+ tapConnect.macAddress = TranslateUtils.parseMac(mac.getValue());
}
if(deviceInstance == null) {
tapConnect.macAddress = new byte[6];
} else {
tapConnect.useRandomMac = 0;
- tapConnect.macAddress = V3poUtils.parseMac(mac.getValue());
+ tapConnect.macAddress = TranslateUtils.parseMac(mac.getValue());
}
if(deviceInstance == null) {
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;
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);
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
.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);
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
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);
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;
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);
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;
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);
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);
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;
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");
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,
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;
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");
.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);
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;
}
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;
// 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();
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)));
}
}
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;
final CompletableFuture<BridgeDomainDetailsReplyDump> bdCompletableFuture =
getFutureJVpp().bridgeDomainSwIfDump(request).toCompletableFuture();
- return V3poUtils.getReply(bdCompletableFuture);
+ return TranslateUtils.getReply(bdCompletableFuture);
}
}
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;
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();
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);
}
}
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;
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();
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));
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;
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
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;
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);
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,
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;
} 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));
}
}
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;
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);
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);
* 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;
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 {
}
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>() {
-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);
}
@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