import io.fd.vpp.jvpp.core.dto.InputAclSetInterface;
import io.fd.vpp.jvpp.core.dto.InputAclSetInterfaceReply;
import io.fd.vpp.jvpp.core.future.FutureJVppCoreFacade;
-import javax.xml.bind.DatatypeConverter;
/**
* <p>Tests L2 ACL creation and read.<br> Equivalent to the following vppctl commands:<br>
public class L2AclExample {
private static final int LOCAL0_IFACE_ID = 0;
+ private static final char[] hexArray = "0123456789ABCDEF".toCharArray();
+
private static ClassifyAddDelTable createClassifyTable() {
ClassifyAddDelTable request = new ClassifyAddDelTable();
return request;
}
+ private static String bytesToHex(byte[] bytes) {
+ char[] hexChars = new char[bytes.length * 2];
+ for ( int j = 0; j < bytes.length; j++ ) {
+ int v = bytes[j] & 0xFF;
+ hexChars[j * 2] = hexArray[v >>> 4];
+ hexChars[j * 2 + 1] = hexArray[v & 0x0F];
+ }
+ return new String(hexChars);
+ }
+
private static ClassifyTableInfo createClassifyTableInfoRequest(final int tableId) {
ClassifyTableInfo request = new ClassifyTableInfo();
request.tableId = tableId;
private static void print(final ClassifyTableInfoReply reply) {
System.out.println(reply);
if (reply != null) {
- System.out.println("Mask hex: " + DatatypeConverter.printHexBinary(reply.mask));
+ System.out.println("Mask hex: " + bytesToHex(reply.mask));
}
}
System.out.println(reply);
reply.classifySessionDetails.forEach(detail -> {
System.out.println(detail);
- System.out.println("Match hex: " + DatatypeConverter.printHexBinary(detail.match));
+ System.out.println("Match hex: " + bytesToHex(detail.match));
});
}